import request from '@/utils/request'

// 查询学分记录列表
export function listCredit(query) {
  return request({
    url: '/secondclass/credit/list',
    method: 'get',
    params: query
  })
}

// 查询学分记录详细
export function getCredit(recordId) {
  return request({
    url: '/secondclass/credit/' + recordId,
    method: 'get'
  })
}

// 新增学分记录
export function addCredit(data) {
  return request({
    url: '/secondclass/credit',
    method: 'post',
    data: data
  })
}

// 修改学分记录
export function updateCredit(data) {
  return request({
    url: '/secondclass/credit',
    method: 'put',
    data: data
  })
}

// 更新学分记录状态
export function updateCreditStatus(recordId, status) {
  return request({
    url: '/secondclass/credit/status/' + recordId,
    method: 'put',
    params: { status: status }
  })
}

// 删除学分记录
export function delCredit(recordId) {
  return request({
    url: '/secondclass/credit/' + recordId,
    method: 'delete'
  })
}

// 导出学分记录
export function exportCredit(query) {
  return request({
    url: '/secondclass/credit/export',
    method: 'get',
    params: query
  })
}

// 获取用户学分统计
export function getUserCreditStats(userId) {
  return request({
    url: '/secondclass/credit/stats/' + userId,
    method: 'get'
  })
}

// 获取当前学期
export function getCurrentSemester() {
  return request({
    url: '/secondclass/credit/semester/current',
    method: 'get'
  })
}

// 获取所有学期列表
export function getSemesterList() {
  return request({
    url: '/secondclass/credit/semester/list',
    method: 'get'
  })
}

// 获取学分统计总览数据
export function getCreditStatsOverview() {
  return request({
    url: '/secondclass/credit/stats/overview',
    method: 'get'
  })
} 